package jwdt.xadmin.custom.service.impl;


import jwdt.common.dao.BaseDao;
import jwdt.xadmin.custom.bean.TCustomLog;
import jwdt.xadmin.custom.service.CustomLogManageService;

import com.ezerg.db.ext.PageUtil;
import com.ezerg.util.StringUtil;
public class CustomLogManageServiceImpl implements CustomLogManageService{
	private BaseDao<TCustomLog> baseDao;
	
	public void setBaseDao(BaseDao<TCustomLog> baseDao) {
		this.baseDao = baseDao;
	}
	@Override
	public PageUtil doList(PageUtil pu,TCustomLog tc) throws Exception{
		String where = "";
		String title = tc.getTitle();
		if(!StringUtil.nullOrBlank(title)) {
			where += " title like '%" + title + "%'";
		}
		String sql = " order by dt desc";
		pu.doList(TCustomLog.class,where+sql);
		//创造json数据对象
		return pu;
	}
	@Override
	public String doAddact(TCustomLog obj,int userid) throws Exception {
		obj.setUserid(userid);
		String ret = baseDao.doAddObj(obj);
		return ret;
	}

	@Override
	public String doEditact(TCustomLog obj, int id,String contact) throws Exception {
		String ret = baseDao.doUpdateObj(TCustomLog.class, id, obj);
		return ret;
	};
	
	@Override
	public String doDelact(int id) throws Exception {
		return baseDao.doDelObj(TCustomLog.class, id);
	}

	@Override
	public TCustomLog doLoad(int id) throws Exception {
		return baseDao.doLoadObj(TCustomLog.class, id);
	}
}
